Skip to content

Add user chat feature with text input field#39

Open
ZhengyuLin wants to merge 7 commits intomainfrom
feature/text-input
Open

Add user chat feature with text input field#39
ZhengyuLin wants to merge 7 commits intomainfrom
feature/text-input

Conversation

@ZhengyuLin
Copy link

No description provided.

@ZhengyuLin ZhengyuLin self-assigned this Dec 25, 2025
*/
const handleSendMessage = () => {
if (chatMessage.trim()) {
console.log('[Handle Text Message]:', chatMessage)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

日志可以移除或改为debug级别

const [globalState, setGlobalState] = useState<GlobalState>()
const webSocketState = useWebSocket()
const [isSceneInitialized, setIsSceneInitialized] = useState(false)
const [chatMode, setChatMode] = useState<'text' | 'voice'>('voice')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否考虑在浏览器中存储上一次使用的聊天模式?语言选项(中文或英文)应该是缓存的,下次进入时仍然会使用之前的选项

"send": "Send",
"autoMode": "Auto Mode",
"confirm": "Confirm",
"disconnect": "Disconnect",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少connect

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm 其实是 connect,这是livestream 用的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里评论的原因是发现中英不一致,英文有confirm没有connect,中文有connect没有confirm,需要统一

Comment on lines +175 to +181
const recordAudioButton = this.recordAudioButton
recordAudioButton.verticalAlignment =
BABYLON_GUI.Control.VERTICAL_ALIGNMENT_BOTTOM
recordAudioButton.horizontalAlignment =
BABYLON_GUI.Control.HORIZONTAL_ALIGNMENT_CENTER
recordAudioButton.top = vh(-10) + 'px'
recordAudioButton.isVisible = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const recordAudioButton = this.recordAudioButton
recordAudioButton.verticalAlignment =
BABYLON_GUI.Control.VERTICAL_ALIGNMENT_BOTTOM
recordAudioButton.horizontalAlignment =
BABYLON_GUI.Control.HORIZONTAL_ALIGNMENT_CENTER
recordAudioButton.top = vh(-10) + 'px'
recordAudioButton.isVisible = true
this.recordAudioButton.verticalAlignment =
BABYLON_GUI.Control.VERTICAL_ALIGNMENT_BOTTOM
this.recordAudioButton.horizontalAlignment =
BABYLON_GUI.Control.HORIZONTAL_ALIGNMENT_CENTER
this.recordAudioButton.top = vh(-10) + 'px'
this.recordAudioButton.isVisible = true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textfield在不同设备上实测下来有点过大。一般来说用户每轮对话不会输入大量的text,即便是一次性输入了大量的text,也应该自适应调整textfield大小,建议修改为更紧凑的UI layout

截屏2026-01-15 15 53 57 截屏2026-01-15 15 52 55

"voiceChat": "语音聊天",
"inputMessagePlaceholder": "输入消息...",
"send": "发送",
"autoMode": "自动模式",
Copy link
Member

@WYK96 WYK96 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"autoMode": "自动模式",

此处没有被实际使用到

"voiceChat": "Voice Chat",
"inputMessagePlaceholder": "Enter message...",
"send": "Send",
"autoMode": "Auto Mode",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"autoMode": "Auto Mode",

此处没有被实际使用到

# next.js
/.next/
/out/
package-lock.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package-lock.json

目前使用pnpm进行包管理,不会再出现npm build时生成的package-lock.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants